Release: | |
Reference: | |
Publication date: | |
Print date: | June 30, 2005 |
rpm -Uvh openldap-2.1.29-1.i386.rpm rpm -Uvh openldap-servers-2.1.29-1.i386.rpm rpm -Uvh openldap-clients-2.1.29-1.i386.rpm
rpm -Uvh samba-3.0.10-2.i386.rpm rpm -Uvh samba-client-3.0.10-2.i386.rpm rpm -Uvh samba-common-3.0.10-2.i386.rpmOf course, you can also use the default RedHat package.
rpm -Uvh smbldap-tools-0.8.8-1.i386.rpmsmbldap-tools will continue to evoluate. Consult the ChangeLog in the CVS source tree to see if changes are interesting for your context. For this Howto setup however, we encourage you to use release 0.8.8 as they are sufficient for the limited use they cover
(using Relative DN notation) dc=IDEALX,dc=ORG | `--- ou=Users : to store user accounts for Unix and Windows systems | `--- ou=Computers : to store computer accounts for Windows systems | `--- ou=Groups : to store system groups for Unix and Windows | systems (or for any other LDAP-aware systems) | `--- ou=DSA : to store special accounts (simpleSecurityObject) systems (or for any other LDAP-aware systems)This DIT is compliant with recommandations from RFC 2307bis. We did not use ou=Host to store computer accounts as there is a difference between TCP/IP hosts and Microsoft Windows computer accounts. We used ou=DSA to store specific security accounts for LDAP Clients, in the context of the smbldap-tools (look at the 5 section for more details and example).
|
|
|
|
[root@etoile]$ slappasswd -h {SSHA} -s mysecretpwd {SSHA}X+Qv3lKnVB/oov2uvC6Id1nfEkgYaPrdAvailable algorithm are CRYPT, MD5, SMD5, SSHA, and SHA. The default is SSHA. The resulting lines in the file/etc/openldap/slapd.conf will then be
|
|
/etc/init.d/ldap startEverything should work fine. If not:
|
|
|
|
|
|
|
|
NET USE J: \\PDC-SRV\doc NET TIME \\PDC-SRV /SET /YES
mkdir /home/samba mkdir /home/samba/netlogon mkdir /home/samba/profiles chmod 1777 /home/samba/profiles
[root@pdc-srv samba]# smbpasswd -w mysecretpwd Setting stored password for "cn=Manager,dc=IDEALX,dc=ORG" in secrets.tdbSamba will store this datas in /etc/samba/secrets.tbd.
net getlocalsidNote that you need to start samba for several minutes for this command to successfull finished)
[root@etoile root]# smbldap-populate Populating LDAP directory for domain IDEALX-NT (S-1-5-21-4205727931-4131263253-1851132061) (using builtin directory structure) adding new entry: dc=idealx,dc=org adding new entry: ou=Users,dc=idealx,dc=org adding new entry: ou=Groups,dc=idealx,dc=org adding new entry: ou=Computers,dc=idealx,dc=org adding new entry: uid=root,ou=Users,dc=idealx,dc=org adding new entry: uid=nobody,ou=Users,dc=idealx,dc=org adding new entry: cn=Domain Admins,ou=Groups,dc=idealx,dc=org adding new entry: cn=Domain Users,ou=Groups,dc=idealx,dc=org adding new entry: cn=Domain Guests,ou=Groups,dc=idealx,dc=org adding new entry: cn=Domain Computers,ou=Groups,dc=idealx,dc=org adding new entry: cn=Administrators,ou=Groups,dc=idealx,dc=org adding new entry: cn=Account Operators,ou=Groups,dc=idealx,dc=org adding new entry: cn=Print Operators,ou=Groups,dc=idealx,dc=org adding new entry: cn=Backup Operators,ou=Groups,dc=idealx,dc=org adding new entry: cn=Replicators,ou=Groups,dc=idealx,dc=org adding new entry: sambaDomainName=IDEALX-NT,dc=idealx,dc=org Please provide a password for the domain root: Changing password for root New password : Retype new password :The sambaDomainName=IDEALX-NT,dc=idealx,dc=org entry define the samba domain and specially it's domain SID. We also use it to defined the next uidNumber and gidNumber available for creating new users and groups. The default values for those numbers are 1000. You can change it with the -u and -g option. For example, if you want the first available value for uidNumber and gidNumber to be set to 1500, you can use the following command :
smbldap-populate -u 1550 -g 1500The 'Administrator' user's password, ie the root account password is immediatly defined. In fact, any user placed in the "Domain Admins" group will be granted Windows admin rights for the domain, but only the Administrator account is allowed to join computers to the domain.
ldapadd -x -h localhost -D "cn=Manager,dc=IDEALX,dc=ORG" -f smbldap-dsa.ldif -WFinally, set the default password to those accounts:
ldappasswd -x -h localhost -D "cn=Manager,dc=IDEALX,dc=ORG" -s sambasecretpwd \ -W cn=samba,ou=DSA,dc=IDEALX,dc=ORG
ldappasswd -x -h localhost -D "cn=Manager,dc=IDEALX,dc=ORG" -s nssldapsecretpwd \ -W cn=nssldap,ou=DSA,dc=IDEALX,dc=ORG
ldappasswd -x -h localhost -D "cn=Manager,dc=IDEALX,dc=ORG" -s smbldapsecretpwd \ -W cn=smbldap-tools,ou=DSA,dc=IDEALX,dc=ORG
[root@pdc-srv tmp]# smbldap-useradd -m testuser1 [root@pdc-srv tmp]# smbldap-passwd testuser1 Changing password for testuser1 New password : Retype new password :Then, try to login on your system (Unix login) as testuser1 (using another console, or using ssh). Everything should work fine :
[user@host-one:~]$ ssh testuser1@pdc-srv testuser1@pdc-srv's password: Last login: Sun Dec 23 15:49:40 2004 from host-one [testuser1@pdc-srv testuser1]$ id uid=1000(testuser1) gid=100(users) groupes=100(users)Dont forget to delete this testuser1 after having completed your tests :
[root@pdc-srv]# smbldap-userdel -r testuser1
|
|
smbpasswd -w sambasecretpwd
|
mkdir certs csr datas keys private datas/ca.db.certs touch private/ca.key datas/ca.db.serial cp /dev/null datas/ca.db.index
openssl rand 1024 > datas/random-bits
openssl genrsa -des3 -out private/ca.key 1024 -rand datas/random-bits chmod 600 private/ca.keyWarning: key the ca.key private !
openssl req -new -x509 -days 3650 -key private/ca.key -out certs/ca.pem
|
echo '01' > datas/ca.db.serial
openssl genrsa -out keys/ldap.idealx.com.key 1024
openssl req -new -key keys/ldap.idealx.com.key -out csr/ldap.idealx.com.csr
openssl ca -config ca.conf -out certs/ldap.idealx.com.txt -infiles csr/ldap.idealx.com.csr
perl -n -e 'm/BEGIN CERTIFICATE/ && do {$$seen=1}; $$seen && print;' < certs/ldap.idealx.com.txt > certs/ldap.idealx.com.pem
openssl verify -CAfile certs/ca.pem certs/ldap.idealx.com.pem
cp /etc/passwd /etc/shadow /tmp/
for user in root nobody bin daemon do export user perl -i -pe's@^$ENV{user}:(.*)\n@@' /tmp/passwd perl -i -pe's@^$ENV{user}:(.*)\n@@' /tmp/shadow donedon't forget to remove the user nobody as it is created when initializing the directory with smbldap-populate.
/usr/share/doc/smbldap-tools-*/smbldap-migrate-unix-accounts -a -P /tmp/passwd -S /tmp/shadow
cp /etc/group /tmp/
for group in root bin daemon do export group perl -i -pe's@^$ENV{group}:(.*)\n@@' /tmp/group done
/usr/share/doc/smbldap-tools-*/smbldap-migrate-unix-groups -a -G /tmp/group
|
|
Attribute from schema Usage cn core usually, the username uid core username description core TODO userPassword core password for Unix systems using NSS/PAM LDAP displayName inetorgperson TODO uidNumber nis the numeric user number (Unix and Samba) gidNumber nis the primary group number of the user (Unix) loginShell nis the logon shell used on Unix systems gecos nis the long form of the username homeDirectory nis home directory path for Unix systems sambaPwdLastSet samba The integer time in seconds since 1970 when the lm and ntpasswd were last set. sambaLogonTime samba timestamp of last logon sambaLogoffTime samba timestamp of last logoff sambaKickoffTime samba timestamp of when the user will be logged off automatically sambaPwdCanChange samba timestamp of when the user is allowed to update the password sambaPwdMustChange samba timestamp of when the password will expire sambaPwdLastSet samba timestamp of the last password update sambaAcctFlags samba specify the type of the samba account sambaBadPasswordCount samba Bad password attempt count sambaBadPasswordTime samba Time of the last bad password attempt (W=workstation, U=user, D=disabled, X=no password expiration,...) sambaSID samba the secure identifier (SID) of the user sambaPrimaryGroupID samba the relative identifier (SID) of the primary group of the user sambaHomePath samba specifies the path of the home directory for the user. The string can be null. If homeDrive is set and specifies a drive letter, homeDirectory should be a UNC path. The path must be a network UNC path. This value can be a null string sambaLogonScript samba The scriptPath property specifies the path of the user's logon script, .CMD, .EXE, or .BAT file. The string can be null. The path is relative to the netlogon share sambaLMmPassword samba the LANMAN password sambaNTPassword samba the NT password (md4 hash) sambaHomeDrive samba specifies the drive letter to which to map the UNC path specified by homeDirectory. The drive letter must be specified in the form "driveletter:" where driveletter is the letter of the drive to map. For example: "Z:" sambaProfilePath samba specifies a path to the user's profile. This value can be a null string, a local absolute path, or a UNC path
Table 1: Attributes used for a user Account
[root@pdc-srv testsmbuser2]# smbldap-useradd -m testposixuser [root@pdc-srv testsmbuser2]# smbldap-passwd testposixuser Changing password for testposixuser New password for user testposixuser: Retype new password for user testposixuser:
[root@pdc-srv testsmbuser2]# smbldap-useradd -a -m -c "John Doo" jdoo [root@pdc-srv testsmbuser2]# smbldap-passwd jdoo Changing password for jdoo New password for user jdoo: Retype new password for user jdoo:
[root@pdc-srv testsmbuser2]# smbldap-passwd jdoo Changing password for jdoo New password for user jdoo: Retype new password for user jdoo:
[root@pdc-srv testsmbuser2]# smbldap-userdel -r jdooIn this example, we wanted to remove the user named 'jdoo' and his home directory.
dn: cn=unixGroup,ou=Groups,dc=idealx,dc=org objectClass: posixGroup cn: unixGroup gidNumber: 1000 memberUid: usertest1 memberUid: usertest2Here's a LDAP view of a Samba group named sambaGroup:
|
Group name rid Group SID Description Domain Admins 512 $SID-512 Domain Users 513 $SID-513 Domain Guests 514 $SID-514 Print Operators 550 S-1-5-32-550 Backup Operators 551 S-1-5-32-551 Replicator 552 S-1-5-32-552
Table 2: Well known rid and corresponding SID of windows administrative groups. $SID refer to the domain secure ID
|
[root@pdc-srv root]# smbldap-useradd -w testcomputer1You can also use the automatic procedure within your Microsoft Windows client (see your client chapter: Microsoft Windows NT, w2k...) for more information.
[root@pdc-srv root]# smbldap-userdel testcomputer1$Instead of removing the computer account, you may want to de-activate the Samba Account. The easyest way is to use the smbldap-usermod script as follow :
mv /opt/samba/profiles/testsmbuser1/NTUSER.DAT /opt/samba/profiles/testsmbuser1/NTUSER.MAN chmod -w /opt/samba/profiles/testsmbuser1/NTUSER.MANThis way, you may want to set up a common user profile for every user on the Domain.
domaine: IDEALX-NT mot de passe: secretLet's establish the trust from the Samba-3 server :
net rpc trustdom establish NT4Note that this command may fail with major release of samba with the following error message:
[root@etoile root]# net rpc trustdom establish IDEALX Password: Could not connect to server POMEROL [2005/06/23 16:52:36, 0] rpc_parse/parse_prs.c:prs_mem_get(537) prs_mem_get: reading data of size 4 would overrun buffer. [2005/06/23 16:52:36, 0] utils/net_rpc.c:rpc_trustdom_establish(4686) WksQueryInfo call failed.This is caused by the security restrictanonymous parameter set on the Windows NT4 server :
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\LSA\RestrictAnonymousIf so, set it to 0 and restart the NT4 server.
smbldap-useradd -i NT4The created account will have a '$' caracter appended to its name (as workstation account), the sambaSAMAccount objectclass and the 'I' flag. A password will also be asked for this account.
smbldap-usermod -G +512 adminuser
enable privileges = yes
net -U root%XXX rpc rights grant 'IDEALX-NT\Domain Admins' SeMachineAccountPrivilege
|
root@on-the-PDC# smbldap-useradd -w short-hostname-of-the-samba-member-serverand then, on the Samba member server itself:
root@on-the-member-server# smbpasswd -j "IDEALX-NT"
net rpc getsid -S NT4_PDC -W NT4_DOMAINAnd we can now configure the smbldap-tools correctly in the /etc/opt/IDEALX/smbldap-tools/smbldap.conf configuration file :
SID="S-1-5-21-191762950-446452569-929701000"Then we can create our directory structure :
smbldap-populate
Workgroup = NT4_DOMAIN domain master = NoWhere NT4_DOMAIN is the domain that the Windows NT4 PDC control.
|
/etc/init.d/smb restartRemark: the two directives delete user script et delete group script can also be used. However, an error message can appear in User Manager even if the operations actually succeed. If you want to enable this behaviour, you need to add
|
net rpc join -Uadministrator%passswordThis will create a DBC server account for the samba server on the NT4 Windows PDC. If this step fail, you certainly have a netbios resolution problem. The best way is to update the /etc/samba/lmhosts to set the internet adress of the primary domain controler. For example, you can have :
192.168.0.1 NT4_PDC 192.168.0.1 NT4_DOMAINwhere NT4_DOMAIN is the domain managed by the NT4_PDC domain controller.
net rpc vampire -S NT4_PDCNote that there is no need to give a user/password for vampire, the procedure is done anonymously using server password (set when joining the domain).
domain master = Yes
/etc/init.d/smb restart
|
Load smb config files from /etc/samba/smb.conf Processing section "[netlogon]" Processing section "[profiles]" Processing section "[printers]" Processing section "[print$]" Processing section "[homes]" Loaded services file OK.
[root@PDC-SRV root]# ps afuxw | grep smb 0 17049 0.0 0.7 5524 1888 ? S 11:45 0:00 smbd -D 1002 17146 0.0 1.3 7184 3408 ? S 11:50 0:00 \_ smbd -D 0 17223 0.1 1.2 7060 3140 ? S 12:00 0:00 \_ smbd -D [root@PDC-SERV root]# ps afuxw | grep nmb 0 17054 0.0 0.7 4636 1856 ? S 11:45 0:00 nmbd -D 0 17057 0.0 0.6 4584 1552 ? S 11:45 0:00 \_ nmbd -D
[root@PDC-SRV root]# ps afuxw | grep ldap ldap 12358 0.0 5.0 16004 12972 ? S Nov14 0:03 /usr/sbin/slapd -u ldapor
[root@PDC-SRV root]# netstat -tan | grep LISTEN | grep 389 tcp 0 0 0.0.0.0:389 0.0.0.0:* LISTEN
$id testsmbusershould return something like that:
[root@speed3 samba]# id testsmbuser uid=1008(testsmbuser) gid=100(users) groups=100(users),501(Domain Users)
|
|
smbldap-useradd -w VMNT$ pdbedit -a -m -u VMNT$Then, try again to join the NT4 server to the domain
defaultComputerGid="513"
|
|
|
|
|
|
|
|
|
|
# apt-get source sambaThen, in the samba-2.2.4/debian edit the following files:
61 [ -f source/Makefile ] || (cd source && ./configure \ 62 --host=$(DEB_HOST_GNU_TYPE) \ 63 --build=$(DEB_BUILD_GNU_TYPE) \ 64 --with-fhs \ 65 --prefix=/usr \ 66 --sysconfdir=/etc \ 67 --with-privatedir=/etc/samba \ 68 --localstatedir=/var \ 69 --with-netatalk \ 70 --with-smbmount \ 71 --with-syslog \ 72 --with-sambabook \ 73 --with-utmp \ 74 --with-readline \ 75 --with-libsmbclient \ 76 --with-winbind \ 77 --with-msdfs \ 78 --with-automount \ 79 --with-acl-support \ 80 --with-profile \ 81 --disable-static \ 82 --with-ldapsam) 131 #install -m 0644 source/nsswitch/pam_winbind.so \ 132 #$(DESTDIR)/lib/security/ 142 #mv $(DESTDIR)/usr/bin/pam_smbpass.so $(DESTDIR)/lib/security/ 182 #cp debian/samba.pamd $(DESTDIR)/etc/pam.d/samba
# dpkg -i samba-common_2.2.4-1_i386.deb libsmbclient_2.2.4-1_i386.deb samba_2.2.4-1_i386.deb smbclient_2.2.4-1_i386.deb smbfs_2.2.4-1_i386.deb swat_2.2.4-1_i386.deb winbind_2.2.4-1_i386.deb
Documents : Copyright © 2002 IDEALX S.A.S.. 'IDEALX' is the property of IDEALX. 'Samba' is the property of Samba Team. All other trademarks belong to their respective owners.
This document was translated from LATEX by HEVEA.